/*
 * @Author: your name
 * @Date: 2021-04-23 23:32:50
 * @LastEditTime: 2021-04-24 07:24:36
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \offer20k\项目代码\fantasticit\src\components\Articletags.tsx
 */
import React,{useEffect} from 'react'
import styles from './Airticlelist.less'
import useStore from '@/context/useStore'
import { TagsOutlined } from '@ant-design/icons'
import {observer} from 'mobx-react-lite'
import {useHistory} from 'umi'

const Articletags = () => {
    let { tag } = useStore()
    const history=useHistory()

    useEffect(() => {
       //  获取文章标签
       tag.getTagList();
    }, [])
    const getArtTag=(value:string,count:number)=>{
         
      history.push(`/article/tagdetail/${value}`,{value,count})

    }
    return (
        <div className={styles.articletags}>
            <div className={styles.icontitle}><TagsOutlined /><span>文章标签</span></div>
            <div>
                <ul>
                    {
                        tag.tagList.map((item: any) => {
                            return <li key={item.id} onClick={()=>{getArtTag(item.value,item.articleCount)}}>
                                <span>{item.label} [{item.articleCount}]</span>
                            </li>
                        })
                    }
                </ul>
            </div>
        </div>
    )
}
export default observer(Articletags);
